//
// Created by jinbang.li on 2023/5/14.
//

#include "IOpObserver.h"
void IOpObserver::addObservers(IOpObserver *obs) {
    if (!obs)return;
    mutex.lock();
    observers.push_back(obs);
    mutex.unlock();
}
void IOpObserver::notify(OpData data) {
    mutex.lock();
    for (int i = 0; i < observers.size(); i++) {
        observers[i]->update(data);
    }
    mutex.unlock();
}